import { pathrouter } from "./pathrouter";
import { states } from "./states";
import { findindexexmenulist } from "./toprevpage";

export function clicknextpagelink() {
    //const appvm = getappvm();
    //Reflect.set(appvm, "nextpagelink", disabledalinkhref);
    var currentpageindex = findindexexmenulist();
    const { menulist } = states;
    if (!(currentpageindex >= 0 && currentpageindex <= menulist.length - 1)) {
        // console.error("没有在菜单列表中找到当前页面");
        return;
    }
    var pageindextogo = currentpageindex + 1;
    /* if (!(pageindextogo >= 0 && pageindextogo <= menulist.length - 1)) {
        // console.error("已经到达菜单列表的起始处或结尾处");
        return;
    }*/
    if (!(pageindextogo >= 0 && pageindextogo <= menulist.length - 1)) {
        pageindextogo = 0;
    }
    let hashtogo = menulist[pageindextogo];
    if (process.env.PRERENDER) {
        pathrouter.setparams({ md: hashtogo });
    } else {
        location.hash = hashtogo;
    }
}
